package com.qf.boot.service.consumer;

import com.qf.boot.service.api.SiteService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

@EnableAutoConfiguration
public class DefaultDubboConsumer {

    //指明服务进行调用
    @Reference(version = "default",url = "dubbo://127.0.0.1:20882/com.qf.boot.service.api.SiteService:default")
    private SiteService siteService;


    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(DefaultDubboConsumer.class);

        SiteService siteService =  (SiteService) context.getBean(SiteService.class);

        String name = siteService.getName("q-face");

        System.out.println(name);

    }
}
